package ${filePackageName};

import ${annotationPackage}.SysLog;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.AfterThrowing;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.stereotype.Component;

/**
 * 日志切面类
 * @author ${projectAuthor}
 * @version 1.0
 * @date ${nowDate}
 */
@Component
@Aspect
public class LogAspect {

	/**
	 * 环绕切入
	 * @param joinPoint 切入点
	 * @param sysLog 切入对象
	 * @return 数据
	 * @throws Throwable 异常
	 */
	@Around(value = "@annotation(sysLog)")
	public Object logAroud(ProceedingJoinPoint joinPoint, SysLog sysLog)
			throws Throwable {
		
		// 执行方法体
		Object result = joinPoint.proceed();
		
		return result;
	}

	/**
	 * 后缀异常
	 * @param joinPoint 切入点
	 * @param sysLog 切入对象
	 * @param e 异常对象
	 * @throws Throwable 异常
	 */
	@AfterThrowing(value = "@annotation(sysLog)",throwing = "e")
	public void afterThrowing(JoinPoint joinPoint, SysLog sysLog,Throwable e)
			throws Throwable {
		e.printStackTrace();
	}
}
